package com.umeng.analytics.pro;

import android.text.TextUtils;
import android.util.Log;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Formatter;
import java.util.Locale;

public class by {
    public static boolean a = false;
    private static String b = null;
    private static final int c = 1;
    private static final int d = 2;
    private static final int e = 3;
    private static final int f = 4;
    private static final int g = 5;
    private static int h;

    static {
        by.a = false;
        by.b = "MobclickAgent";
        by.h = 2000;
    }

    private by() {

    }

    private static void a(int arg6, String arg7, String arg8, Throwable arg9) {
        int v0 = 0;
        if (!TextUtils.isEmpty(((CharSequence) arg8))) {
            int v3 = arg8.length();
            int v1 = by.h;
            int v2 = 0;
            while (true) {
                if (v0 < 100) {
                    if (v3 > v1) {
                        switch (arg6) {
                            case 1: {
                                Log.v(arg7, arg8.substring(v2, v1));
                                break;
                            }
                            case 2: {
                                Log.d(arg7, arg8.substring(v2, v1));
                                break;
                            }
                            case 3: {
                                Log.i(arg7, arg8.substring(v2, v1));
                                break;
                            }
                            case 4: {
                                Log.w(arg7, arg8.substring(v2, v1));
                                break;
                            }
                            case 5: {
                                Log.e(arg7, arg8.substring(v2, v1));
                                break;
                            }
                        }

                        ++v0;
                        v2 = v1;
                        v1 = by.h + v1;
                        continue;
                    } else {
                        switch (arg6) {
                            case 1: {
                                Log.v(arg7, arg8.substring(v2, v3));
                                break;
                            }
                            case 2: {
                                Log.d(arg7, arg8.substring(v2, v3));
                                break;
                            }
                            case 3: {
                                Log.i(arg7, arg8.substring(v2, v3));
                                break;
                            }
                            case 4: {
                                Log.w(arg7, arg8.substring(v2, v3));
                                break;
                            }
                            case 5: {
                                Log.e(arg7, arg8.substring(v2, v3));
                                break;
                            }
                        }
                    }
                }
                break;
            }
        }
        if (arg9 != null) {
            String v0_1 = by.f(arg9);
            if (!TextUtils.isEmpty(((CharSequence) v0_1))) {
                switch (arg6) {
                    case 1: {
                        Log.v(arg7, v0_1);
                        return;
                    }
                    case 2: {
                        Log.d(arg7, v0_1);
                        return;
                    }
                    case 3: {
                        Log.i(arg7, v0_1);
                        return;
                    }
                    case 4: {
                        Log.w(arg7, v0_1);
                        return;
                    }
                    case 5: {
                        Log.e(arg7, v0_1);
                        return;
                    }
                }
                return;
            }
        }
    }

    public static void a(String arg2) {
        by.a(by.b, arg2, null);
    }

    public static void a(String arg1, String arg2, Throwable arg3) {
        if (by.a) {
            by.a(1, arg1, arg2, arg3);
        }
    }

    public static void a(String arg1, Throwable arg2) {
        by.c(by.b, arg1, arg2);
    }

    public static void a(String arg3, Object[] arg4) {
        try {
            String v0_1 = "";
            if (arg3.contains("%")) {
                by.c(by.b, new Formatter().format(arg3, arg4).toString(), null);
                return;
            }

            if (arg4 != null) {
                Object v0_2 = arg4[0];
            }

            Throwable v1 = null;
            by.c(arg3, v0_1, v1);
        } catch (Throwable v0) {
            by.e(v0);
        }
    }

    public static void a(Throwable arg2) {
        by.c(by.b, null, arg2);
    }

    public static void a(Locale arg3, String arg4, Object[] arg5) {
        try {
            by.c(by.b, new Formatter(arg3).format(arg4, arg5).toString(), null);
        } catch (Throwable v0) {
            by.e(v0);
        }
    }

    public static void b(String arg2) {
        by.b(by.b, arg2, null);
    }

    public static void b(String arg1, String arg2, Throwable arg3) {
        if (by.a) {
            by.a(2, arg1, arg2, arg3);
        }
    }

    public static void b(String arg1, Throwable arg2) {
        by.a(by.b, arg1, arg2);
    }

    public static void b(String arg3, Object[] arg4) {
        try {
            String v0_1 = "";
            if (arg3.contains("%")) {
                by.b(by.b, new Formatter().format(arg3, arg4).toString(), null);
                return;
            }

            if (arg4 != null) {
                Object v0_2 = arg4[0];
            }

            Throwable v1 = null;
            by.b(arg3, v0_1, v1);
        } catch (Throwable v0) {
            by.e(v0);
        }
    }

    public static void b(Throwable arg2) {
        by.a(by.b, null, arg2);
    }

    public static void b(Locale arg3, String arg4, Object[] arg5) {
        try {
            by.b(by.b, new Formatter(arg3).format(arg4, arg5).toString(), null);
        } catch (Throwable v0) {
            by.e(v0);
        }
    }

    public static void c(String arg2) {
        by.c(by.b, arg2, null);
    }

    public static void c(String arg3, Object[] arg4) {
        Object v0_2;
        try {
            v0_2 = "";
            if (arg3.contains("%")) {
                by.e(by.b, new Formatter().format(arg3, arg4).toString(), null);
                return;
            }

            if (arg4 != null) {
                v0_2 = arg4[0];
            }

            Throwable v1 = null;
            by.e(arg3, ((String) v0_2), v1);
        } catch (Throwable v0) {
            by.e(v0);
        }
    }

    public static void c(String arg1, String arg2, Throwable arg3) {
        if (by.a) {
            by.a(3, arg1, arg2, arg3);
        }
    }

    public static void c(String arg1, Throwable arg2) {
        by.d(by.b, arg1, arg2);
    }

    public static void c(Throwable arg2) {
        by.d(by.b, null, arg2);
    }

    public static void c(Locale arg3, String arg4, Object[] arg5) {
        try {
            by.e(by.b, new Formatter(arg3).format(arg4, arg5).toString(), null);
        } catch (Throwable v0) {
            by.e(v0);
        }
    }

    public static void d(String arg2) {
        by.d(by.b, arg2, null);
    }

    public static void d(String arg1, String arg2, Throwable arg3) {
        if (by.a) {
            by.a(4, arg1, arg2, arg3);
        }
    }

    public static void d(String arg1, Throwable arg2) {
        by.b(by.b, arg1, arg2);
    }

    public static void d(String arg3, Object[] arg4) {
        try {
            String v0_1 = "";
            if (arg3.contains("%")) {
                by.a(by.b, new Formatter().format(arg3, arg4).toString(), null);
                return;
            }

            if (arg4 != null) {
                Object v0_2 = arg4[0];
            }

            Throwable v1 = null;
            by.a(arg3, v0_1, v1);
        } catch (Throwable v0) {
            by.e(v0);
        }
    }

    public static void d(Throwable arg2) {
        by.b(by.b, null, arg2);
    }

    public static void d(Locale arg3, String arg4, Object[] arg5) {
        try {
            by.a(by.b, new Formatter(arg3).format(arg4, arg5).toString(), null);
        } catch (Throwable v0) {
            by.e(v0);
        }
    }

    public static void e(String arg2) {
        by.e(by.b, arg2, null);
    }

    public static void e(String arg1, Throwable arg2) {
        by.e(by.b, arg1, arg2);
    }

    public static void e(Throwable arg2) {
        by.e(by.b, null, arg2);
    }

    public static void e(String arg1, String arg2, Throwable arg3) {
        if (by.a) {
            by.a(5, arg1, arg2, arg3);
        }
    }

    public static void e(String arg3, Object[] arg4) {
        try {
            String v0_1 = "";
            if (arg3.contains("%")) {
                by.d(by.b, new Formatter().format(arg3, arg4).toString(), null);
                return;
            }

            if (arg4 != null) {
                Object v0_2 = arg4[0];
            }

            Throwable v1 = null;
            by.d(arg3, v0_1, v1);
        } catch (Throwable v0) {
            by.e(v0);
        }
    }

    public static void e(Locale arg3, String arg4, Object[] arg5) {
        try {
            by.d(by.b, new Formatter(arg3).format(arg4, arg5).toString(), null);
        } catch (Throwable v0) {
            by.e(v0);
        }
    }

    public static String f(Throwable arg4) {
        PrintWriter v1_1 = null;
        StringWriter v3 = null;
        StringWriter v2 = null;
        String v0 = "";
        try {
            v3 = new StringWriter();
            v1_1 = new PrintWriter(v3);
            arg4.printStackTrace(v1_1);
            v1_1.flush();
            v3.flush();
            v0 = v3.toString();
            return v0;
        } catch (Throwable v0_1) {
        } finally {
            if (v1_1 != null) {
                try {
                    v1_1.close();
                } catch (Throwable v2_1) {
                }
            }

            if (v3 != null) {
                try {
                    v3.close();
                } catch (Throwable v2_1) {
                }
            }
        }
        return v0;
    }
}

